import {
  adminUrl
} from "@/utils/baseUrl.js";
import request from "@/utils/request";

// 创建课程
export function createClassTimetable(data) {
  return request({
    url: adminUrl + "/study/class-timetable/create",
    method: "post",
    data: data,
  });
}

// 更新课程
export function updateClassTimetable(data) {
  return request({
    url: adminUrl + "/study/class-timetable/update",
    method: "put",
    data: data,
  });
}

// 删除课程
export function deleteClassTimetable(data) {
  return request({
    url: adminUrl + "/study/class-timetable/delete",
    method: "delete",
    data,
  });
}

// 获得课程
export function getClassTimetable(id) {
  return request({
    url: adminUrl + "/study/class-timetable/get?id=" + id,
    method: "get",
  });
}

// 获得课程分页
export function getClassTimetablePage(query) {
  return request({
    url: adminUrl + "/study/class-timetable/page",
    method: "get",
    params: query,
  });
}
//根据班级ID获取课程
export function getClassTimetablePageByClassId(query) {
  return request({
    url: adminUrl + "/study/class-timetable/getClassTimetableListByClassId",
    method: "get",
    params: query,
  });
}
//根据教师ID获取课程
export function getClassTimetablePageByTeacherId(query) {
  return request({
    url: adminUrl + "/study/class-timetable/getClassTimetableListByTeacherId",
    method: "get",
    params: query,
  });
}

// 导出课程 Excel
export function exportClassTimetableExcel(query) {
  return request({
    url: adminUrl + "/study/class-timetable/export-excel",
    method: "get",
    params: query,
    responseType: "blob",
  });
}

//获取上课时间
export function timeAllList() {
  return request({
    url: adminUrl + "/study/time/allList",
    method: "get",
    params: {
      pageNo: 1,
      pageSize: 99,
    },
  });
}
//创建二维码配置
export function createQrcode(data = {}) {
  return request({
    url: adminUrl + "/study/qrcode/create",
    method: "post",
    data,
  });
}
//获取二维码配置
export function getQrcodeSetting(params = {}) {
  return request({
    url: adminUrl + "/study/qrcode/get",
    method: "get",
    params,
  });
}
//更新二维码配置
export function updateQrcode(data = {}) {
  return request({
    url: adminUrl + "/study/qrcode/update",
    method: "put",
    data,
  });
}
